package LinkedStack;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.EmptyStackException;
import java.util.Iterator;

import junit.framework.TestCase;


public class Test extends TestCase {

     public Test(String testName) {
         super(testName);
     }





public void testSize() throws Exception {
LinkedStack<String> queue = new LinkedStack<String>();
queue.push("1st");
queue.push("2nd");
queue.peek();
queue.pop();
queue.push("3rd");
assertTrue(queue.size() == 2);
}



public void testPop() throws Exception {
	LinkedStack<Integer> queue = new LinkedStack<Integer>();
	queue.push(1);
	queue.push(2);
	queue.push(3);
	assertTrue(queue.pop() == 3);
	assertTrue(queue.pop() == 2);
	assertTrue(queue.pop() == 1);
	try {
	queue.pop();
	fail();
	} catch(EmptyStackException e) {
	}
	}

public void testPeek() throws Exception {
LinkedStack<Integer> queue = new LinkedStack<Integer>();
queue.push(1);
queue.push(2);
queue.push(3);
assertTrue(queue.peek() == 3);
assertTrue(queue.peek() == 3);
assertTrue(queue.pop() == 3);
assertTrue(queue.peek() == 2);
assertTrue(queue.peek() == 2);
}
}